home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Magazin: Amiga-CD 1997 November & December
/
Amiga-CD 1997 #11-12.iso
/
pd-disketten
/
ungepackt
/
9_95
/
apd-9-95-2
/
arexx-workshop
/
listings
/
lhaoptions
< prev
next >
Wrap
Text File
|
1996-01-25
|
14KB
|
441 lines
/* LHAOptions for LHAControl written 04.94 by Karsten Wysocki */
call addlib('apig.library',0,-30,0)
call addlib("rexxsupport.library",0,-30,0)
portname = "LHAOptions"
portlist = Showlist('p')
if find(portlist,portname) > 0 then exit
p = openport(portname)
options = getclip('LHAopts')
if options = "" then options = " | x | -e -r -2 | a "
trenn = index(options,'|')
extractswitches = delstr(options,trenn)
options = delstr(options,1,trenn)
trenn = index(options,'|')
extractcommand = delstr(options,trenn)
options = delstr(options,1,trenn)
trenn = index(options,'|')
archivswitches = delstr(options,trenn)
options = delstr(options,1,trenn)
archivcommand = options
call set_apig_globals()
screen = LOCKPUBSCREEN("Workbench")
drinfo = GETSCREENDRAWINFO(screen)
scrvinfo = GETVISUALINFO(screen)
scrfont = GETVALUE(screen,40,4,'p')
glistpointer = ALLOCVEC(4,MEMF_CLEAR)
conxgad = CREATECONTEXT(glistpointer)
previousgadget = conxgad
textid = 10
maketext = "call SETNEWGADGET(newgadx,scrvinfo,scrfont,lft,top,wdt,hgt,'',
PLACETEXT_IN,textid,null());
previousgadget = CREATEGADGET(TEXT_KIND,previousgadget,newgadx,
GTTX_TEXT,txt,TAG_DONE,0)"
txt = "Extract Options:"
lft = 2
top = 2
wdt = 0
hgt = 10
newgadx = MAKENEWGADGET(scrvinfo,scrfont,lft,top,wdt,hgt,"",
,PLACETEXT_IN,textid,null())
previousgadget = CREATEGADGET(TEXT_KIND,previousgadget,newgadx,
,GTTX_TEXT,txt,TAG_DONE,0)
txt = "_________________";top = 4;interpret maketext
lft = 25
txt = "Extract with full path";top = 16;interpret maketext
txt = "Touch extracted files";top = 28;interpret maketext
txt = "Extract only new files";top = 40;interpret maketext
call SETNEWGADGET(newgadx,scrvinfo,scrfont,204,-2,4,55,'',
,PLACETEXT_IN,textid,null());
previousgadget = CREATEGADGET(BUTTON_KIND,previousgadget,newgadx,
,TAG_DONE,0)
txt = "Archive Options:"
lft = 210
top = 2
interpret maketext
txt = "_________________";top = 4;interpret maketext
lft = 233
txt = "Freshen Archive-files";top = 16;interpret maketext
txt = "Archive empty dirs";top = 28;interpret maketext
txt = "Collect files recoursive";top = 40;interpret maketext
lft = 453
txt = "LH5 compression";top = 16;interpret maketext
txt = "LH4 compression";top = 28;interpret maketext
txt = "LH1 compression";top = 40;interpret maketext
call SETNEWGADGET(newgadx,scrvinfo,scrfont,-2,52,589,3,"",
,PLACETEXT_IN,textid,null())
previousgadget = CREATEGADGET(BUTTON_KIND,previousgadget,newgadx,
,TAG_DONE,0)
call SETNEWGADGET(newgadx,scrvinfo,scrfont,3,58,160,14,"Use Options",
,PLACETEXT_IN,40,null())
previousgadget = CREATEGADGET(BUTTON_KIND,previousgadget,newgadx,
,TAG_DONE,0)
call SETNEWGADGET(newgadx,scrvinfo,scrfont,208,58,160,14,"Reset Options",
,PLACETEXT_IN,41,null())
previousgadget = CREATEGADGET(BUTTON_KIND,previousgadget,newgadx,
,TAG_DONE,0)
call SETNEWGADGET(newgadx,scrvinfo,scrfont,413,58,160,14,"Cancel",
,PLACETEXT_IN,42,null())
previousgadget = CREATEGADGET(BUTTON_KIND,previousgadget,newgadx,
,TAG_DONE,0)
wintitle = "LHA Control Options LHAControl is programmed by Karsten Wysocki"
winidcmp = GADGETUP+GADGETDOWN+MOUSEMOVE+SIZEVERIFY+REFRESHWINDOW
winflags = WINDOWDRAG+WINDOWDEPTH+GIMMEZEROZERO+ACTIVATE+SMART_REFRESH
w1 = OPENWINDOW(portname,35,191,585,88,2,4,winidcmp,winflags,wintitle,scr,0,null(),null(),conxgad)
call GT_REFRESHWINDOW(w1,null())
/*------------------------------------------------------- Window Rastport holen ---*/
wrastport = GETWINDOWRASTPORT(w1)
/*------------------------------------ Speicherstruktur für MX-Images erstellen ---*/
imgtags = ALLOCATETAGITEMS(8)
call SETTAGSLOT(imgtags,1,SYSIA_DRAWINFO,'p',drinfo)
call SETTAGSLOT(imgtags,0,SYSIA_WHICH,'n',MXIMAGE)
mximg = NEWOBJECTA(null(),"sysiclass",imgtags)
/*------------------ Code-Variablen für spätere Interpret-Anweisungen definieren ---*/
makebgad = "call makeboolgadget(w1,lft,top-1,18,11,GADGHCOMP,GADGIMMEDIATE,0,0,0,0,gadid,g0)"
gadup = "call DRAWIMAGE(wrastport,mximg,lft,top)"
gaddown = "call DRAWIMAGESTATE(wrastport,mximg,lft,top,IDS_SELECTED,drinfo)"
/*-------------------------------------------------- Definition der Bool-Gadgets ---*/
lft = 2
top = 16;gadid = 11
g0 = makeboolgadget(w1,lft,top-1,18,11,GADGHCOMP,GADGIMMEDIATE,0,0,0,0,gadid,0)
top = 28;gadid = 12;interpret makebgad
top = 40;gadid = 13;interpret makebgad
lft = 210
top = 16;gadid = 21;interpret makebgad
top = 28;gadid = 22;interpret makebgad
top = 40;gadid = 23;interpret makebgad
lft = 430
top = 16;gadid = 31;interpret makebgad
top = 28;gadid = 32;interpret makebgad
top = 40;gadid = 33;interpret makebgad
/*------------------------ Bool-Gadgets an Gadget-Struktur des Fensters anhängen ---*/
z = addglist(w1,g0,-1,-1,0)
z = refreshgadgets(g0,w1,0)
/*----------------------------------------------- Vergleichs-Variablen festlegen ---*/
TRUE = 1
FALSE = 0
LH5 = " -2"
LH4 = " -1"
LH1 = " -0"
recoursiv = " -r"
emptydirs = " -e"
paths = " -x"
touch = " -E"
newfiles = " -G"
archiv = "a"
freshen = "f"
extract = "e"
fullpath = "x"
/*--------- Zustände der Boolgadgets feststellen und entsprechende MX-Images ins ---*/
/*--------- Fenster projezieren. ---*/
hit = index(extractcommand,"x")
lft = 2;top = 16
if hit = FALSE
then do
ex1 = FALSE;ex1sw = extract
interpret gadup
end
else do
ex1 = TRUE;ex1sw = fullpath
interpret gaddown
end
hit = index(extractswitches,"-E")
lft = 2;top = 28
if hit = FALSE
then do
ex2 = FALSE;ex2sw = ""
interpret gadup
end
else do
ex2 = TRUE;ex2sw = touch
interpret gaddown
end
hit = index(extractswitches,"-G")
lft = 2;top = 40
if hit = FALSE
then do
ex3 = FALSE;ex3sw = ""
interpret gadup
end
else do
ex3 = TRUE;ex3sw = newfiles
interpret gaddown
end
hit = index(archivcommand,"f")
lft = 210;top = 16
if hit = FALSE
then do
arc1 = FALSE;arc1sw = archiv
interpret gadup
end
else do
arc1 = TRUE;arc1sw = freshen
interpret gaddown
end
hit = index(archivswitches,"-e")
lft = 210;top = 28
if hit = FALSE
then do
arc2 = FALSE;arc2sw = ""
interpret gadup
end
else do
arc2 = TRUE;arc2sw = emptydirs
interpret gaddown
end
hit = index(archivswitches,"-r")
lft = 210;top = 40
if hit = FALSE
then do
arc3 = FALSE;arc3sw = ""
interpret gadup
end
else do
arc3 = TRUE;arc3sw = recoursiv
interpret gaddown
end
lft = 430
LHcomp = "FALSE"
hit = index(archivswitches,"-0")
if hit ~= FALSE
then do
LHcomp = LH1
top = 16;interpret gadup
top = 28;interpret gadup
top = 40;interpret gaddown
end
hit = index(archivswitches,"-1")
if hit ~= FALSE
then do
LHcomp = LH4
top = 16;interpret gadup
top = 28;interpret gaddown
top = 40;interpret gadup
end
hit = index(archivswitches,"-2")
if hit ~= FALSE | LHcomp = "FALSE"
then do
LHcomp = LH5
top = 16;interpret gaddown
top = 28;interpret gadup
top = 40;interpret gadup
end
/*-------------------------------------------- Beginn der Hauptprogrammschleife ---*/
exitme = 0
do while exitme = 0
x = waitpkt(portname)
do forever
msg = getpkt(portname)
if msg = '0000 0000'x then leave
msgclass = getarg(msg,0)
if msgclass = DIE then exitme = 1
if msgclass = CLOSEWINDOW then exitme = 1
if msgclass = SIZEVERIFY then exitme = 1
if msgclass = GADGETDOWN | msgclass = GADGETUP then
do
gadid = getarg(msg,9)
select
when gadid = 11 then
do
lft = 2;top = 16
if ex1 = TRUE
then do
ex1 = FALSE;interpret gadup
ex1sw = extract
end
else do
ex1 = TRUE;interpret gaddown
ex1sw = fullpath
end
end
when gadid = 12 then
do
lft = 2;top = 28
if ex2 = TRUE
then do
ex2 = FALSE;interpret gadup
ex2sw = ""
end
else do
ex2 = TRUE;interpret gaddown
ex2sw = touch
end
end
when gadid = 13 then
do
lft = 2;top = 40
if ex3 = TRUE
then do
ex3 = FALSE;interpret gadup
ex3sw = ""
end
else do
ex3 = TRUE;interpret gaddown
ex3sw = newfiles
end
end
when gadid = 21 then
do
lft = 210;top = 16
if arc1 = TRUE
then do
arc1 = FALSE;interpret gadup
arc1sw = archiv
end
else do
arc1 = TRUE;interpret gaddown
arc1sw = freshen
end
end
when gadid = 22 then
do
lft = 210;top = 28
if arc2 = TRUE
then do
arc2 = FALSE;interpret gadup
arc2sw = ""
end
else do
arc2 = TRUE;interpret gaddown
arc2sw = emptydirs
end
end
when gadid = 23 then
do
lft = 210;top = 40
if arc3 = TRUE
then do
arc3 = FALSE;interpret gadup
arc3sw = ""
end
else do
arc3 = TRUE;interpret gaddown
arc3sw = recoursiv
end
end
when gadid = 31 then
do
lft = 430
top = 16;interpret gaddown
top = 28;interpret gadup
top = 40;interpret gadup
LHcomp = LH5
end
when gadid = 32 then
do
lft = 430
top = 16;interpret gadup
top = 28;interpret gaddown
top = 40;interpret gadup
LHcomp = LH4
end
when gadid = 33 then
do
lft = 430
top = 16;interpret gadup
top = 28;interpret gadup
top = 40;interpret gaddown
LHcomp = LH1
end
when gadid = 40 then
do
archivswitches = arc2sw || arc3sw || LHcomp
archivcommand = arc1sw
extractswitches = ex2sw || ex3sw
extractcommand = ex1sw
options = 'LHAOptions' extractswitches '|' extractcommand '|' archivswitches '|' archivcommand
ADDRESS 'LHAControl' options
exitme = 1
end
when gadid = 41 then
do
lft = 2;top = 16
ex1 = TRUE;interpret gaddown
ex1sw = fullpath
lft = 2;top = 28
ex2 = FALSE;interpret gadup
ex2sw = ""
lft = 2;top = 40
ex3 = FALSE;interpret gadup
ex3sw = ""
lft = 210;top = 16
arc1 = FALSE;interpret gadup
arc1sw = archiv
lft = 210;top = 28
arc2 = TRUE;interpret gaddown
arc2sw = emptydirs
lft = 210;top = 40
arc3 = TRUE;interpret gaddown
arc3sw = recoursiv
lft = 430
top = 16;interpret gaddown
top = 28;interpret gadup
top = 40;interpret gadup
LHcomp = LH5
end
when gadid = 42 then exitme = 1
otherwise nop
end
end
x = reply(msg,0)
end
if exitme = 1 then leave
end
call DISPOSEOBJECT(mximg)
call CLOSEWINDOW(w1)
call FREESCREENDRAWINFO(screen,drinfo)
call UNLOCKPUBSCREEN(null(),screen)
call FREEVISUALINFO(scrvinfo)
call FREETAGITEMS(imgtags)
call FREEGADGETS(conxgad)
call FREETHIS(newgadx)
call FREEVEC(glistpointer)
ADDRESS 'LHAControl' 'LHAOptions END'
exit